package de.koller.inclination.render;

import de.koller.inclination.INNode;
import de.koller.oceanFramework.math.RVec2;
import de.koller.oceanFramework.math.RVec3;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.geom.AffineTransform;
import java.awt.geom.Line2D;

public class INRender extends INNode {
	
	public void renderThis( Graphics2D g ) {
//		g.setRenderingHint( RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY );
//		g.setRenderingHint( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON );
//		g.setRenderingHint( RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY );
//		g.setRenderingHint( RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR );
//		g.setRenderingHint( RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY );
//		g.setRenderingHint( RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_DEFAULT );
//		g.setRenderingHint( RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON );
		
		AffineTransform ba = g.getTransform();
		g.translate( 400, 300 );
		
		g.setColor( Color.WHITE );
		RVec2 v0 = ParallelProjection.project( new RVec3( -100, 0, -100 ) );
		RVec2 v1 = ParallelProjection.project( new RVec3( -100, 0,  100 ) );
		RVec2 v2 = ParallelProjection.project( new RVec3(  100, 0,  100 ) );
		RVec2 v3 = ParallelProjection.project( new RVec3(  100, 0, -100 ) );
		
		RVec2 v4 = ParallelProjection.project( new RVec3( -100, 200,  100 ) );
		RVec2 v5 = ParallelProjection.project( new RVec3(  100, 200,  100 ) );
		RVec2 v6 = ParallelProjection.project( new RVec3(  100, 200, -100 ) );
		
		
//		g.draw( new Line2D.Float( v0.x, v0.y, v1.x, v1.y ) );
//		g.draw( new Line2D.Float( v1.x, v1.y, v2.x, v2.y ) );
//		g.draw( new Line2D.Float( v2.x, v2.y, v3.x, v3.y ) );
//		g.draw( new Line2D.Float( v3.x, v3.y, v0.x, v0.y ) );
//		
//		g.draw( new Line2D.Float( v1.x, v1.y, v4.x, v4.y ) );
//		g.draw( new Line2D.Float( v2.x, v2.y, v5.x, v5.y ) );
//		g.draw( new Line2D.Float( v3.x, v3.y, v6.x, v6.y ) );
//		
//		g.draw( new Line2D.Float( v4.x, v4.y, v5.x, v5.y ) );
//		g.draw( new Line2D.Float( v5.x, v5.y, v6.x, v6.y ) );
		
		g.setColor( Color.RED );
		//g.setStroke( new BasicStroke( 5 ) );
		for( float r = 0; r < 2*Math.PI; r += Math.PI / 128f ) {
			float x = (float)Math.cos( r ) * 16f;
			float z = (float)Math.sin( r ) * 16f;
			
			RVec2 v = ParallelProjection.project( new RVec3( x, 0, z ) );
			g.draw( new Line2D.Float( v.x, v.y, v.x, v.y ) );
		}
		
		g.setTransform( ba );
	}

}
